<?php
session_start();
require('class/auth.php');
include_once('class/autoload.php'); // pour inclure nos classes

if(Auth::islog()){
}else{
	header('Location:index.php');
}
$site = new page_securiser('acceuil');


$site->titre = "Appartement";
$site->corps='<span id="bouton_retour"><input type="button" value="Retour aux annonce" onclick="location.href=\'acceuil.php\';"></span>';

$id=$_GET['id_appart'];
$Appartement = new page_appartement($id);


$site->affiche();
?>
<script language="javascript">
function ChangeImage(url)
{
document.getElementById('img').src = url;
}


	
	</script> 

<div class= 'text_et_image_appart'>
<div class='texte_appart'>
<ul><span class="puce"><li>Description: <?php echo $Appartement->libelleAppart ?></li></span>
<span class="puce"><li>Adresse: <?php echo $Appartement->adRue ?></li></span>
<span class="puce"><li>Code Postal: <?php echo $Appartement->adCP ?></li></span>
<span class="puce"><li>Ville: <?php echo $Appartement->adVille ?></li></span>
<span class="puce"><li>Surface: <?php echo $Appartement->surface ?> M&egravetre&sup2</li></span>
<span class="puce"><li>Distance de Chevrollier: <?php echo $Appartement->distanceLycee/1000 ?> KM&egravetre</li></span>
<span class="puce"><li>Prix loyer: <?php echo $Appartement->prixLoyer ?> &euro;</li></span>
<span class="puce"><li>Type: <?php echo $Appartement->typeA ?></li></span>
<span class="puce"><li>Description:<br> <?php echo $Appartement->description ?></li></span></ul>

<ul><span class="puce"><li>Envoyer e-mail: <br> <a class="lien_appatement" href="contact.php?=<?php echo $Appartement->email_locataire;?>"><?php echo $Appartement->email_locataire?></a></li></span>
<span class="puce"><li>Numero de telephone: <br><?php echo $Appartement->tel_locataire;?></li></span></ul>

</div>
<div class='image_appart'>

<img  id='img' class='imageprincipal' src=<?php $_SERVER['HTTP_ORIGIN'] ?>/images/<?php echo $Appartement->url1 ?>.jpg  alt=''/>


<table id="position_tableau">
<tr>
<td><?php if (!empty($Appartement->url1)){?><img onClick="ChangeImage(this.src);" id='image1' src=<?php $_SERVER['HTTP_ORIGIN'] ?>/images/<?php echo $Appartement->url1 ?>.jpg  alt='plouf'/><?php ;}?></td>
</tr>
<tr>
<td><?php if (!empty($Appartement->url2)){?><img onClick="ChangeImage(this.src);" id='image2' src=<?php $_SERVER['HTTP_ORIGIN'] ?>/images/<?php echo $Appartement->url2 ?>.jpg  alt='evrzgr'/><?php ;}?></td>
</tr>
<tr>
<td><?php if (!empty($Appartement->url3)){?><img onClick="ChangeImage(this.src);" id='image3' src=<?php $_SERVER['HTTP_ORIGIN'] ?>/images/<?php echo $Appartement->url3 ?>.jpg  alt='erg'/><?php ;}?></td>
</tr>
<tr>
<td><?php if (!empty($Appartement->url4)){?><img onClick="ChangeImage(this.src);" id='image4' src=<?php $_SERVER['HTTP_ORIGIN'] ?>/images/<?php echo $Appartement->url4 ?>.jpg  alt='erg'/><?php ;}?></td>
</table>
</div>
</div>
<?php 
$site->footer();

